import React, { useState } from "react";
import HookCounter from "./HookCounter";

const EffectClear = () => {
  const [visible, setVisible] = useState(true);

  return (
    <div>
      <button onClick={() => setVisible(!visible)}>
        {visible ? "消失" : "出现"}
      </button>
      <hr />
      {visible ? <HookCounter /> : <div></div>}
    </div>
  );
};

export default EffectClear;
